<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        var name = "The Window";
        var object = {
            name: "My Object",
            getNameFunc: function () {
                alert('1.' + this.name);// My object
                return function () {
                    return this.name;
                };
            }
        };

        var func = object.getNameFunc();
        alert('2.' + func()); //window
        alert('3.' + func.call(object)); //My object
        alert('4.' + func.apply(object)); //My object


    </script>
</body>

</html>